<?php

namespace App\Admin\Controllers\Audit;

use App\Admin\Actions\Audit\AuditBankAction;
use App\Admin\Grid\NGrid;
use App\Admin\Service\AuditService;
use App\Library\Traits\AdminControllerTrait;
use App\Models\AuditModel;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Grid\Displayers\Actions;
use Encore\Admin\Grid\Filter;

class AuditBankController extends AdminController
{
    protected $title = '银行卡';

    private AuditService $service;

    /**
     * @param AuditService $service
     */
    public function __construct(AuditService $service)
    {
        $this->service = $service;
    }

    protected function grid(): NGrid
    {
        $this->service->grid('bank');
        $this->service->column('serialNumber,userMobile,realName');
        $this->service->grid->column('content', __('audit.bank.identity'));
        $this->service->column('createdAt');
        $this->service->grid->disableActions(false);
        $this->service->grid->actions(function (Actions $action) {
            $action->disableEdit();
            $action->disableDelete();
            $action->disableView();
            $action->add(new AuditBankAction);
        });
        return $this->service->grid;
    }
}
